from Dialog import *
from src.gui.FileSelector import *

class CreateMapDialog(Dialog):

	def __init__(self, parent=None):
		Dialog.__init__(self, "New map", parent)

	def buildForm(self, form):
		# form widgets
		self.spin_map_width = QSpinBox()
		self.spin_map_width.setRange(1, 100)

		self.spin_map_height = QSpinBox()
		self.spin_map_height.setRange(1, 100)

		self.spin_zone_width = QSpinBox()
		self.spin_zone_width.setRange(1, 100)

		self.spin_zone_height = QSpinBox()
		self.spin_zone_height.setRange(1, 100)

		self.selector_tileset = FileSelector()

		form.addRow("Number of zones (width)", self.spin_map_width)
		form.addRow("Number of zones (height)", self.spin_map_height)
		form.addRow("Tiles per zone (width)", self.spin_zone_width)
		form.addRow("Tiles per zone (height)", self.spin_zone_height)
		form.addRow("Path to tileset", self.selector_tileset)

	def getMapProperties(self):
		props = {}
		props["map_width"] = self.spin_map_width.value()
		props["map_height"] = self.spin_map_height.value()
		props["zone_width"] = self.spin_zone_width.value()
		props["zone_height"] = self.spin_zone_height.value()
		props["tileset"] = self.selector_tileset.getFilename()
		return props
